Skip to content

feat: update admin feedback API and add request changes button for application#1040

Merged
iamitprakash merged 6 commits intodevelopfrom
refactor/application-superuser-feedback
Feb 26, 2026
Merged

feat: update admin feedback API and add request changes button for application#1040
iamitprakash merged 6 commits intodevelopfrom
refactor/application-superuser-feedback

Conversation

@MayankBansal12
Copy link
Member

@MayankBansal12 MayankBansal12 commented Feb 25, 2026

Date: 25-02-26

Developer Name: @MayankBansal12


Issue Ticket Number

Description

  • Updated API and request body for feedback API
  • Add request changes button
  • Update status badge and new fields for score and nudge count

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screencast
feedback-demo.mp4
tests image

AnujChhikara and others added 4 commits February 24, 2026 01:15
- Introduced a new button for requesting changes in application details.
- Updated the application feedback submission logic to handle 'changes_requested' status.
- Enhanced tests to cover new functionality, including success and error toast messages.
- Adjusted styles for the new button to ensure consistent UI.
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Walkthrough

A "Request Changes" feature is added to the application details modal, enabling users to request modifications to pending applications with accompanying feedback. Changes include a new UI button, updated API integration to a feedback endpoint, validation logic for feedback text, status badge styling, and expanded test coverage for the new workflow.

Changes

Cohort / File(s) Summary
Test Suite Updates
__tests__/applications/applications.test.js
Added test scenarios for the "Request Changes" button visibility and functionality; validates error toast when feedback is missing and success toast on valid feedback submission; updated expected feedback messages from "application updated successfully!" to "Application feedback submitted successfully".
UI Elements
applications/index.html
Added new button element with class application-details-request-changes and aria-label "Request changes" in the application details actions section, positioned alongside Accept and Reject buttons.
Application Logic
applications/script.js
Replaced updateApplication with submitApplicationFeedback; updated updateUserApplication signature to accept { status: actionStatus } instead of { isAccepted }; added validation requiring non-empty feedback for 'changes_requested' status; enhanced UI with status badges and feedback-section visibility toggling; wired new button to pass 'changes_requested' status with feedback text.
Styling
applications/style.css
Added status badge styling (.status-badge variants); introduced .application-details-request-changes button with hover, active, and focus-visible states; replaced separate accepted/rejected message selectors with combined set including changes message; reduced primary action button width from 40% to 30%.
API Integration
applications/utils.js
Renamed updateApplication to submitApplicationFeedback with new signature { applicationId, status, feedback }; updated endpoint from PATCH /applications/{id} to PATCH /applications/{id}/feedback; modified payload to conditionally include feedback; enhanced error handling with safe JSON parsing and fallback error messages; inverted showToast signature from { message, type } to (type, message).

Sequence Diagram

sequenceDiagram
    participant User
    participant Client as Client/UI
    participant API as API Server
    participant Toast as Toast Notifier

    User->>Client: Click "Request Changes" button
    activate Client
    Client->>Client: Open application details modal<br/>(pending status)
    Client->>Client: Display feedback textarea
    User->>Client: Enter feedback text
    User->>Client: Click confirm/submit
    
    alt Feedback validation fails
        Client->>Toast: Show error toast<br/>("feedback required")
        Toast->>User: Display error message
    else Feedback validation succeeds
        Client->>API: PATCH /applications/{id}/feedback<br/>{ status: 'changes_requested', feedback: text }
        activate API
        API->>API: Process feedback submission
        API->>Client: Return success response
        deactivate API
        Client->>Toast: Show success toast<br/>("Application feedback submitted successfully")
        Toast->>User: Display success message
        Client->>Client: Close modal & update UI<br/>(show changes requested badge)
    end
    deactivate Client
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A button blooms for changes sweet,
With feedback fields where thoughts can meet,
Status badges shine so bright,
From pending states to changed delight!
Carrots of wisdom, validation true. 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main changes: updating the feedback API and adding the request changes button functionality for applications.
Description check ✅ Passed The PR description clearly relates to the changeset, detailing API updates, new request changes button, and status badge enhancements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/application-superuser-feedback

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
applications/script.js (1)

229-263: 🧹 Nitpick | 🔵 Trivial

application forEach parameter shadows the outer openApplicationDetails parameter.

The loop variable application at line 229 shadows the function parameter of the same name. While the status-check logic at lines 286–341 is correctly outside the loop and references the outer binding, the shadowing makes the code hard to reason about at a glance and risks future bugs if logic is moved inside the loop.

♻️ Suggested rename
-  selectedApplication.applicationDetails.forEach((application) => {
+  selectedApplication.applicationDetails.forEach((detail) => {
     const applicationSection = createElement({ ... });
     const applicationSectionTitle = createElement({
       ...
-      innerText: application.title,
+      innerText: detail.title,
     });
     let applicationSectionDescription;
-    if (application.title === 'Status') {
-      const statusLabel = application.description
+    if (detail.title === 'Status') {
+      const statusLabel = detail.description
         ...
       applicationSectionDescription = createElement({
         ...
-        attributes: { class: `status-badge status-badge--${application.description}` },
-        innerText: statusLabel,
+        attributes: { class: `status-badge status-badge--${detail.description}` },
+        innerText: statusLabel,
       });
     } else {
       applicationSectionDescription = createElement({
         ...
-        innerText: application.description,
+        innerText: detail.description,
       });
     }
     ...
   });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@applications/script.js` around lines 229 - 263, The forEach loop parameter
named application shadows the outer openApplicationDetails parameter; rename the
loop variable used in selectedApplication.applicationDetails.forEach (and its
internal references like application.title, application.description,
applicationSection, applicationSectionDescription) to a nonconflicting name such
as detail or appDetail, update every use inside that loop accordingly, and leave
the outer openApplicationDetails binding and the separate status-check logic
untouched so there is no variable shadowing or potential future confusion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@__tests__/applications/applications.test.js`:
- Around line 75-94: The interceptor branch matching url
`${STAGING_API_URL}/applications/lavEduxsb2C5Bl4s289P` contains an unreachable
non-GET branch because submitApplicationFeedback issues a PATCH to the
`/feedback` suffix; remove the dead code by deleting the conditional branch that
handles method !== 'GET' (the JSON response with message 'Application feedback
submitted successfully') inside the interceptedRequest.respond block for that
exact URL, leaving only the GET response that returns pendingApplications[0];
ensure the actual PATCH handler remains in the separate interceptor that matches
the `/feedback` URL so submitApplicationFeedback is still tested.

In `@applications/index.html`:
- Around line 135-140: Update the Request changes button so its aria-label
matches the sibling buttons' pattern and casing: change the aria-label on the
element with class "application-details-request-changes" to "Request Application
Changes" (and ensure the visible button text follows the same capitalization if
needed) so it consistently uses the "[Action] Application" format like the
Accept and Reject buttons.

In `@applications/script.js`:
- Around line 281-283: The textarea's placeholder is never set because the
property is named "placeHolder" (wrong casing); update the element creation to
use the standard "placeholder" attribute (e.g., change placeHolder to
placeholder or call setAttribute('placeholder', 'Add Feedback here (required for
Request changes)')) in the code that builds the element (where the object with
placeHolder and innerText is used) so the browser renders the hint correctly.
- Around line 178-185: The Score and Nudge Count sections render the literal
"undefined" because createElement sets element.textContent to
application.score/application.nudgeCount even when they are undefined; update
the code that builds these sections (where application.score and
application.nudgeCount are used) to guard against missing values by either (a)
only creating/pushing the section if the value is not null/undefined, or (b)
coerce the value to a safe display string (e.g., empty string or "—") before
passing it into createElement; reference the createElement helper and the
application.score and application.nudgeCount usages to locate and apply this
conditional check.

---

Outside diff comments:
In `@applications/script.js`:
- Around line 229-263: The forEach loop parameter named application shadows the
outer openApplicationDetails parameter; rename the loop variable used in
selectedApplication.applicationDetails.forEach (and its internal references like
application.title, application.description, applicationSection,
applicationSectionDescription) to a nonconflicting name such as detail or
appDetail, update every use inside that loop accordingly, and leave the outer
openApplicationDetails binding and the separate status-check logic untouched so
there is no variable shadowing or potential future confusion.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5463d34 and e606ca0.

📒 Files selected for processing (5)
  • __tests__/applications/applications.test.js
  • applications/index.html
  • applications/script.js
  • applications/style.css
  • applications/utils.js

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 25, 2026

Deploying dashboard-rds with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4b421cc
Status: ✅  Deploy successful!
Preview URL: https://708211b1.dashboard-rds.pages.dev
Branch Preview URL: https://refactor-application-superus.dashboard-rds.pages.dev

View logs

@MayankBansal12 MayankBansal12 force-pushed the refactor/application-superuser-feedback branch from e5d4a95 to 7c8f537 Compare February 25, 2026 17:10
@MayankBansal12 MayankBansal12 changed the title feat: update feedback API and add request changes for application feat: update admin feedback API and add request changes button for application Feb 25, 2026
@iamitprakash iamitprakash merged commit 3e502ce into develop Feb 26, 2026
5 checks passed
@iamitprakash iamitprakash deleted the refactor/application-superuser-feedback branch February 26, 2026 22:08
@MayankBansal12 MayankBansal12 mentioned this pull request Feb 26, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants